﻿namespace LanSunERP
{
    using System;
    using System.ServiceModel;
    using System.Windows.Forms;
    using System.Diagnostics;
    using System.Collections.Generic;
    using System.Runtime.Serialization;
    using System.Collections;
    using System.Data;
    using System.Data.SqlClient;

    public class GoodsMoveMentRecord:QueryCommand
    {
                public GoodsMoveMentRecord() : base () { }
                public GoodsMoveMentRecord(SqlCommand cmdSQL, DataTable dtRequest,string RequestJob)
         : base(cmdSQL, dtRequest,RequestJob) {  }
        public SqlCommand BuildCommand()
        {
           switch (RequestJob.Substring(6, 10))
            {


                //GoodsMoveMentRecord
                case "0000": break;
                case "1000": break;
                case "1001":
                    cmdSQL.Parameters.Add(new SqlParameter("@SysID", dwRequest["SysID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ToInstanceID", dwRequest["ToInstanceID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ToInstanceKey", dwRequest["ToInstanceKey"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ToInstanceType", dwRequest["ToInstanceType"].ToString()));
                    break;
                case "1002": break;
                case "2000": 
                case "3000":
                    cmdSQL.Parameters.Add(new SqlParameter("@SysID", dwRequest["SysID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@MovementID", dwRequest["MovementID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@MovementTypeID", dwRequest["MovementTypeID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@MovementTypeKey", dwRequest["MovementTypeKey"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@MovementDirection", dwRequest["MovementDirection"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@MoveMentDate", dwRequest["MoveMentDate"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@MovementTime", dwRequest["MovementTime"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Remark", dwRequest["Remark"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@InstanceID", dwRequest["InstanceID"].ToString()));
                    cmdSQL = BuildInstanceKey(cmdSQL, dwRequest);
                    cmdSQL.Parameters.Add(new SqlParameter("@InstanceType", dwRequest["InstanceType"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@AssemblePointID", dwRequest["AssemblePointID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@AssemblePointKey", dwRequest["AssemblePointKey"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ProcessPointID", dwRequest["ProcessPointID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ProcessPointKey", dwRequest["ProcessPointKey"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ToInstanceID", dwRequest["ToInstanceID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ToInstanceKey", dwRequest["ToInstanceKey"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@ToInstanceType", dwRequest["ToInstanceType"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@StockWharehouse", dwRequest["StockWharehouse"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@StockArea", dwRequest["StockArea"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@StockPlace", dwRequest["StockPlace"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@GoodsType", dwRequest["GoodsType"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@GoodsTypeKeyDefID", dwRequest["GoodsTypeKeyDefID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@GoodsKeyID", dwRequest["GoodsKeyID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Quantity", dwRequest["Quantity"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@UnitOfMeasure", dwRequest["UnitOfMeasure"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@SubStatus", dwRequest["SubStatus"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Status", dwRequest["Status"].ToString()));
                    
                    break;
                case "2001":case "4000":
                    cmdSQL.Parameters.Add(new SqlParameter("@InstanceID", dwRequest["InstanceID"].ToString())); 
                    break;
            }
             return cmdSQL;

        }      

    }
}